import { createRouter, createWebHashHistory } from 'vue-router';

export default createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      // 主页
      path: '/',
      name: '首页',
      component: () => import('@/views/home/index.vue'),
      children: [
        {
          // 首页内容
          path: '',
          name: '首页',
          component: () => import('@/views/home/pages/home/index.vue'),
        },
        {
          // 分类
          path: '/category/:id',
          name: '分类',
          component: () => import('@/views/home/pages/category/index.vue'),
        },
        {
          // 二级分类
          path: '/sub-category/:id',
          name: '二级分类',
          component: () => import('@/views/home/pages/sub-category/index.vue'),
        },
        {
          // 商品详情
          path: '/goods-detail/:id',
          name: '商品详情',
          component: () => import('@/views/home/pages/goods-detail/index.vue'),
        },
      ],
    },
    {
      // 登录
      path: '/login',
      name: '登录',
      component: () => import('@/views/login/index.vue'),
    },
  ],
});
